<?php

/**
 * EmsFeature form base class.
 *
 * @method EmsFeature getObject() Returns the current form's model object
 *
 * @package    ems1
 * @subpackage form
 * @author     Jacobo Martínez
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEmsFeatureForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'is_enabled'        => new sfWidgetFormInputCheckbox(),
      'is_new'            => new sfWidgetFormInputCheckbox(),
      'type_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Type'), 'add_empty' => false)),
      'content_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Content'), 'add_empty' => false)),
      'features_block_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FeaturesBlock'), 'add_empty' => false)),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'is_enabled'        => new sfValidatorBoolean(array('required' => false)),
      'is_new'            => new sfValidatorBoolean(array('required' => false)),
      'type_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Type'))),
      'content_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Content'))),
      'features_block_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('FeaturesBlock'))),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('ems_feature[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'EmsFeature';
  }

}
